#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->resize(800, 600);

    label = new MyLabel(this);
    label->setText("hello");
    label->setFrameStyle(QFrame::Panel|QFrame::Plain);
    label->move(300, 300);

    QObject::connect(label, &MyLabel::myClicked,
                     this, &MainWindow::changeLabel);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::changeLabel(){
    QString text = ui->label->text();
    text.append("you");
    ui->label->setText(text);
}
